# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libwmf
pkgver=0.2.12
pkgrel=0
pkgdesc="A library for reading vector images in Microsoft's native Windows Metafile Format (WMF)."
url="http://wvware.sourceforge.net/libwmf.html"
arch="all"
license="LGPL-2.0-or-later"
depends="ghostscript-fonts"
makedepends="libpng-dev>=1.4.0 freetype-dev jpeg-dev>=8 expat-dev
	automake autoconf libtool"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/caolanm/libwmf/archive/v$pkgver.tar.gz
	freetype.patch
	"

prepare() {
	default_prepare
	autoreconf -fi -Ipatches
}

build() {
	./configure --prefix=/usr \
		--with-gsfontdir=/usr/share/fonts/Type1 \
		--with-fontdir=/usr/share/fonts/Type1 \
		--with-gsfontmap=/usr/share/ghostscript/9.10/lib/Fontmap.GS
	make
}

package() {
	make -j1 DESTDIR="$pkgdir" install
	# Remove fonts, these are in ghostscript-fonts
	rm -rf "$pkgdir/usr/share/fonts"
}

sha512sums="9280851e560becc91546906b911e0c59a1abd690e10680f6d94a335d66aeaec5eb12ccf2214ee7af2a15729a7b5f8b906022822399b4e2bc12c75a2d75748cab  libwmf-0.2.12.tar.gz
d60ec85731f4d797c7188883302dc816c77b7ad7d87fe5187e2237e84e0ccfb5b017a3398bb20f0fc14bad53270c8940360858063bb0ae063437d2a255e3874d  freetype.patch"
